﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage2 : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Session ["name"]!=null )
        {
            Label_status.Text = "当前用户：" + Session["name"];

        }
        else
        {
            Label_status.Text = "当前状态：未登录"; 
        }
        if (!IsPostBack)
        {
            Binddate();
            Binddat();
           
        }
    }
    protected void Binddate()
    {
        users us = new users();
        gvyaopin.DataSource = us.GetAllyaopin(us);
        gvyaopin.DataBind();
    }
    protected void Binddat()
    {
        users us = new users();
        gvyao.DataSource = us.GetAllxiaoshou(us);
        gvyao.DataBind();
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToLongTimeString();
    }

    protected void lb_exit_Click1(object sender, EventArgs e)
    {
        Session.RemoveAll();
        Response.Write("<script>window.alert('已注销，请先登录！');location.href='loginn.aspx';</script>");
    }
    protected void gvyaopin_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void btncha_Click(object sender, EventArgs e)
    {

    }
}
